package com.gx.smart.building.ui.common.util;

import android.text.TextPaint;
import android.text.style.ClickableSpan;
import android.view.View;

/**
 * @author: xiaosy
 * 时间: 2021/6/15
 * @Description: 定义texview 局部点击事件
 * @Version: 1.0
 **/
public class TextViewClickableSpan extends ClickableSpan {

    private View.OnClickListener mListener;

    public TextViewClickableSpan(View.OnClickListener mListener) {
        this.mListener = mListener;
    }

    @Override
    public void onClick(View v) {
        if (mListener != null) {
            mListener.onClick(v);
        }
    }

    @Override
    public void updateDrawState(TextPaint ds) {
        ds.setUnderlineText(false);    //去除超链接的下划线
    }
}
